{{template "base/base.html" .}}
{{template "base/base_common.html" .}}
{{define "meta"}}<title>{{i18n .Lang "post.post_new"}} - {{i18n .Lang "app_name"}}</title>{{end}}
{{define "body"}}
<div class="row">
    <div id="content" class="col-md-9">
        <div class="box">
            <div class="cell first breadcrumb">
                <a href="{{.AppUrl}}"><i class="icon icon-home"></i></a><i class="divider icon-angle-right"></i>{{if .Topic}}<a href="{{.Topic.Link}}">{{.Topic.GetName .Lang}}</a><i class="divider icon-angle-right"></i>{{end}}{{i18n .Lang "post.post_new"}}
            </div>
            <div class="cell last">
                <form id="post-new" method="POST" action="{{.AppUrl}}new{{if .Topic}}?topic={{.Topic.Slug}}{{end}}">
                    {{.xsrf_html}}{{.once_html}}

                    <div class="form-group">
                        {{with .PostFormSets.Fields.Lang}}
                            <div class="post-langs{{if .Error}} has-error{{end}}">
                                {{call .Field}}
                            </div>
                        {{end}}
                        {{with .PostFormSets.Fields.Category}}
                            <div class="post-categories{{if .Error}} has-error{{end}}">
                                {{call .Field}}
                            </div>
                        {{end}}
                        {{with .PostFormSets.Fields.Topic}}
                            <div class="post-topics{{if .Error}} has-error{{end}}">
                                {{call .Field}}
                            </div>
                        {{end}}
                        <span class="clearfix"></span>
                    </div>

                    {{with .PostFormSets.Fields.Title}}
                        <div class="form-group{{if .Error}} has-error{{end}}">
                            {{call .Field}}
                            {{if .Error}}<p class="error-block">{{.Error}}</p>{{end}}
                            {{if .Help}}<p class="help-block">{{.Help}}</p>{{end}}
                        </div>
                    {{end}}

                    <div class="markdown-editor"  data-preview-url="{{$.AppUrl}}api/md" data-savekey="post/new">
                        {{with .PostFormSets.Fields.Content}}
                            {{template "post/component/editor.html" dict "root" $ "Field" .Field "Error" .Error "Help" .Help}}
                        {{end}}
                    </div>

                    <div class="form-group">
                        <button type="submit" class="btn btn-primary">{{i18n .Lang "submit"}} <i class="icon-chevron-sign-right"></i></button>
                    </div>
                </form>
            </div>
        </div>
	</div>
    <div id="sidebar" class="col-md-3">
        <div class="box">
            <div class="cell first">{{i18n .Lang "new_post_prompt"}}</div>
            <div class="cell last">
                <ul class="sidebar-list">
                    <li>{{i18n .Lang "new_post_prompt_content_1"}}</li>
                    <li>{{i18n .Lang "new_post_prompt_content_2"}}</li>
                    <li>{{i18n .Lang "new_post_prompt_content_3"}}</li>
                </ul>
            </div>
        </div>

        <div class="box">
            <div class="cell first">{{i18n .Lang "help"}}</div>
            <div class="cell last">
                <ul class="sidebar-list">
                    <li><a target="_blank" href="http://daringfireball.net/projects/markdown/syntax">{{i18n .Lang "markdown_syntax_1"}}</a></li>
                    <li>{{i18n .Lang "markdown_syntax_2"}}</li>
                    <li>{{i18n .Lang "markdown_syntax_3"}}</li>
                    <li>{{i18n .Lang "markdown_syntax_4"}}</li>
                    <li>{{i18n .Lang "markdown_syntax_5"}}</li>
                    <li>{{i18n .Lang "markdown_syntax_6"}}</li>
                    <li>{{i18n .Lang "markdown_syntax_7"}}</li>
                </ul>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
</script>
{{end}}
